// Classes specific to this example
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkRegularPolygonSource.h>
// Generic VTK pipeline elements
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
// Auxiliary class
#include <vtkNamedColors.h>
#include <vtkNew.h>
#include <vtkProperty.h>
#include <vtkAxesActor.h>
#include <vtkTransform.h>

int main(int, char *[]) {
    vtkNew<vtkNamedColors> colors;

    // Create a circle
    vtkNew<vtkRegularPolygonSource> polygonSource;
    // Comment this line to generate a disk instead of a circle.
    polygonSource->GeneratePolygonOff();
    polygonSource->SetNumberOfSides(50);
    polygonSource->SetRadius(5);
    polygonSource->SetCenter(0, 0, 0);

    std::cout << "polygoneSource: " << polygonSource->GetRadius() << std::endl;

    vtkNew<vtkRegularPolygonSource> polygonSource2;
    // Comment this line to generate a disk instead of a circle.
    polygonSource2->GeneratePolygonOff();
    polygonSource2->SetNumberOfSides(50);
    polygonSource2->SetRadius(5);
    polygonSource2->SetCenter(0, 0, 10);

    vtkNew<vtkRegularPolygonSource> polygonSource3;
    // Comment this line to generate a disk instead of a circle.
    polygonSource3->GeneratePolygonOff();
    polygonSource3->SetNumberOfSides(50);
    polygonSource3->SetRadius(5);
    polygonSource3->SetCenter(0, 0, 5);
    polygonSource3->SetNormal(1,0,0);

    std::cout << "polygoneSource2: " << polygonSource2->GetRadius();

    // Visualize
    vtkNew<vtkPolyDataMapper> mapper;
    mapper->SetInputConnection(polygonSource->GetOutputPort());

    vtkNew<vtkPolyDataMapper> mapper2;
    mapper2->SetInputConnection(polygonSource2->GetOutputPort());

    vtkNew<vtkPolyDataMapper> mapper3;
    mapper3->SetInputConnection(polygonSource3->GetOutputPort());

    vtkNew<vtkActor> actor;
    actor->SetMapper(mapper);
    actor->GetProperty()->SetColor(colors->GetColor3d("Cornsilk").GetData());

    vtkNew<vtkActor> actor2;
    actor2->SetMapper(mapper2);
    actor2->GetProperty()->SetColor(colors->GetColor3d("Red").GetData());

    vtkNew<vtkActor> actor3;
    actor3->SetMapper(mapper3);
    actor3->GetProperty()->SetColor(colors->GetColor3d("Blue").GetData());

    vtkNew<vtkRenderer> renderer;
    renderer->AddActor(actor);
    renderer->AddActor(actor2);
    renderer->AddActor(actor3);
    renderer->SetBackground(colors->GetColor3d("DarkGreen").GetData());

    vtkNew<vtkAxesActor> axes;
    vtkNew<vtkAxesActor> axes2;
    vtkNew<vtkAxesActor> axes3;

    vtkNew<vtkTransform> transform;
    transform->Translate(0.0, 0.0, 10.0);
    axes2->SetUserTransform(transform);

    renderer->AddActor(axes);
    renderer->AddActor(axes2);

    vtkNew<vtkRenderWindow> renderWindow;
    renderWindow->AddRenderer(renderer);

    vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;
    renderWindowInteractor->SetRenderWindow(renderWindow);

    renderWindow->SetWindowName("Circle");
    renderWindow->Render();
    renderWindowInteractor->Start();

    return EXIT_SUCCESS;
}
